# -*- coding: utf-8 -*-
# File : config.py
# Author: taoyahui
# Date : 2021/10/17

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_cors import *
import redis

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql://root:123456@192.168.226.134:3306/cbp"
db = SQLAlchemy(app)
# r'/*' 是通配符，让本服务器所有的URL 都允许跨域请求
CORS(app, resources=r'/*')

admin_address = '0x261228c8b566be40d5595acb934f7583f2c39dad'
webase_host = "192.168.226.134"
contract_name = 'CrossBonderPayment'
contract_address = '0xf98d99e8744edf2ea17b1e244eb9388ca4691a48'
contract_abi= [{"constant":False,"inputs":[{"name":"tid","type":"uint256"}],"name":"rejectTransaction","outputs":[],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"uAddr","type":"address"},{"name":"balance","type":"uint256"}],"name":"updateUserBalanec","outputs":[],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"tid","type":"uint256"}],"name":"getTransaction","outputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"address"},{"name":"","type":"uint8"},{"name":"","type":"uint256"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"uAddr","type":"address"},{"name":"tid","type":"uint256"}],"name":"bankFreezeUserAccount","outputs":[],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":True,"inputs":[{"name":"uAddr","type":"address"}],"name":"getUser","outputs":[{"name":"","type":"address"},{"name":"","type":"string"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"uint256[]"},{"name":"","type":"uint256[]"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[{"name":"baddr","type":"address"}],"name":"getBank","outputs":[{"name":"","type":"address"},{"name":"","type":"string"},{"name":"","type":"uint256[]"},{"name":"","type":"uint256[]"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":True,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":False,"stateMutability":"view","type":"function"},{"constant":False,"inputs":[{"name":"receiveUAddr","type":"address"},{"name":"balance","type":"uint256"}],"name":"userSubmitTransaction","outputs":[{"name":"","type":"uint256"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"baddr","type":"address"},{"name":"name","type":"string"}],"name":"createBank","outputs":[{"name":"","type":"address"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"tid","type":"uint256"}],"name":"confirmTransaction","outputs":[],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"uAddr","type":"address"},{"name":"name","type":"string"},{"name":"baddr","type":"address"},{"name":"balance","type":"uint256"}],"name":"createUser","outputs":[{"name":"","type":"address"}],"payable":False,"stateMutability":"nonpayable","type":"function"},{"constant":False,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":False,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":False,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":False,"inputs":[{"indexed":True,"name":"previousOwner","type":"address"},{"indexed":True,"name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"}]
redis_service = redis.StrictRedis(host="192.168.226.134", port=6379, db=0)
